﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Hosting;
using Configuration.ServerApi.Param;
using Configuration.ServerApi.Service;
using System.Threading.Tasks;

namespace Configuration.ServerApi.Controllers
{
    /// <summary>
    /// 组件相关Controller
    /// </summary>
    [Authorize("AuthJwt")]
    [Route("api/[controller]")]
    [ApiController]
    public class AssemblyController : ControllerBase
    {
        private readonly IHostEnvironment HostEnvironment;
        private readonly IAssemblyService AssemblyService;

        #region 构造函数

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="hostEnvironment"></param>
        /// <param name="assemblyService"></param>
        public AssemblyController(IHostEnvironment hostEnvironment,
            IAssemblyService assemblyService)
        {
            HostEnvironment = hostEnvironment;
            AssemblyService = assemblyService;
        }

        #endregion

        #region 获取组件分类列表

        /// <summary>
        /// 获取组件分类列表
        /// </summary>
        /// <param name="param">搜索条件</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("FlowAssemblyClassifyList")]
        public async Task<IActionResult> FlowAssemblyClassifyList(SearchModel param)
        {
            return await AssemblyService.FlowAssemblyClassifyList(param);
        }

        #endregion

        #region 获取组件分类详情

        /// <summary>
        /// 获取组件分类详情
        /// </summary>
        /// <param name="param">搜索条件</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("FlowAssemblyClassifyDetail")]
        public async Task<IActionResult> FlowAssemblyClassifyDetail(SearchModel param)
        {
            return await AssemblyService.FlowAssemblyClassifyDetail(param);
        }

        #endregion

        #region 提交组件分类信息

        /// <summary>
        /// 提交组件分类信息
        /// </summary>
        /// <param name="param">更新参数集</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("SubmitFlowAssemblyClassify")]
        public async Task<IActionResult> SubmitFlowAssemblyClassify(UpdateModel param)
        {
            return await AssemblyService.SubmitFlowAssemblyClassify(param);
        }

        #endregion

        #region 批量删除组件分类信息

        /// <summary>
        /// 批量删除组件分类信息
        /// </summary>
        /// <param name="param">更新参数集</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("DelFlowAssemblyClassify")]
        public async Task<IActionResult> DelFlowAssemblyClassify(UpdateModel param)
        {
            return await AssemblyService.DelFlowAssemblyClassify(param);
        }

        #endregion

        #region 更新组件分类信息状态

        /// <summary>
        /// 更新组件分类信息状态
        /// </summary>
        /// <param name="param">更新参数集</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("UpdateFlowAssemblyClassifyStstus")]
        public async Task<IActionResult> UpdateFlowAssemblyClassifyStstus(UpdateModel param)
        {
            return await AssemblyService.UpdateFlowAssemblyClassifyStstus(param);
        }

        #endregion

        #region 更新组件分类信息顺序

        /// <summary>
        /// 更新组件分类信息顺序
        /// </summary>
        /// <param name="param">更新参数集</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("UpdateFlowAssemblyClassifySort")]
        public async Task<IActionResult> UpdateFlowAssemblyClassifySort(UpdateModel param)
        {
            return await AssemblyService.UpdateFlowAssemblyClassifySort(param);
        }

        #endregion

        #region 获取组件配置列表

        /// <summary>
        /// 获取组件配置列表
        /// </summary>
        /// <param name="param">搜索条件</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("FlowAssemblyConfigList")]
        public async Task<IActionResult> FlowAssemblyConfigList(SearchModel param)
        {
            return await AssemblyService.FlowAssemblyConfigList(param);
        }

        #endregion

        #region 获取组件配置详情

        /// <summary>
        /// 获取组件配置详情
        /// </summary>
        /// <param name="param">搜索条件</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("FlowAssemblyConfigDetail")]
        public async Task<IActionResult> FlowAssemblyConfigDetail(SearchModel param)
        {
            return await AssemblyService.FlowAssemblyConfigDetail(param);
        }

        #endregion

        #region 提交组件配置信息

        /// <summary>
        /// 提交组件配置信息
        /// </summary>
        /// <param name="param">更新参数集</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("SubmitFlowAssemblyConfig")]
        public async Task<IActionResult> SubmitFlowAssemblyConfig(UpdateModel param)
        {
            return await AssemblyService.SubmitFlowAssemblyConfig(param);
        }

        #endregion

        #region 批量删除组件配置信息

        /// <summary>
        /// 批量删除组件配置信息
        /// </summary>
        /// <param name="param">更新参数集</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("DelFlowAssemblyConfig")]
        public async Task<IActionResult> DelFlowAssemblyConfig(UpdateModel param)
        {
            return await AssemblyService.DelFlowAssemblyConfig(param);
        }

        #endregion

        #region 更新组件配置信息状态

        /// <summary>
        /// 更新组件配置信息状态
        /// </summary>
        /// <param name="param">更新参数集</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("UpdateFlowAssemblyConfigStstus")]
        public async Task<IActionResult> UpdateFlowAssemblyConfigStstus(UpdateModel param)
        {
            return await AssemblyService.UpdateFlowAssemblyConfigStstus(param);
        }

        #endregion

        #region 更新组件配置信息顺序

        /// <summary>
        /// 更新组件配置信息顺序
        /// </summary>
        /// <param name="param">更新参数集</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("UpdateFlowAssemblyConfigSort")]
        public async Task<IActionResult> UpdateFlowAssemblyConfigSort(UpdateModel param)
        {
            return await AssemblyService.UpdateFlowAssemblyConfigSort(param);
        }

        #endregion

        #region 获取组件属性配置列表

        /// <summary>
        /// 获取组件属性配置列表
        /// </summary>
        /// <param name="param">搜索条件</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("FlowAssemblyConfigAttributeList")]
        public async Task<IActionResult> FlowAssemblyConfigAttributeList(SearchModel param)
        {
            return await AssemblyService.FlowAssemblyConfigAttributeList(param);
        }

        #endregion

        #region 获取组件属性配置详情

        /// <summary>
        /// 获取组件属性配置详情
        /// </summary>
        /// <param name="param">搜索条件</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("FlowAssemblyConfigAttributeDetail")]
        public async Task<IActionResult> FlowAssemblyConfigAttributeDetail(SearchModel param)
        {
            return await AssemblyService.FlowAssemblyConfigAttributeDetail(param);
        }

        #endregion

        #region 提交组件属性配置信息

        /// <summary>
        /// 提交组件属性配置信息
        /// </summary>
        /// <param name="param">更新参数集</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("SubmitFlowAssemblyConfigAttribute")]
        public async Task<IActionResult> SubmitFlowAssemblyConfigAttribute(UpdateModel param)
        {
            return await AssemblyService.SubmitFlowAssemblyConfigAttribute(param);
        }

        #endregion

        #region 批量删除组件属性配置信息

        /// <summary>
        /// 批量删除组件属性配置信息
        /// </summary>
        /// <param name="param">更新参数集</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("DelFlowAssemblyConfigAttribute")]
        public async Task<IActionResult> DelFlowAssemblyConfigAttribute(UpdateModel param)
        {
            return await AssemblyService.DelFlowAssemblyConfigAttribute(param);
        }

        #endregion

        #region 更新组件属性配置信息状态

        /// <summary>
        /// 更新组件属性配置信息状态
        /// </summary>
        /// <param name="param">更新参数集</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("UpdateFlowAssemblyConfigAttributeStstus")]
        public async Task<IActionResult> UpdateFlowAssemblyConfigAttributeStstus(UpdateModel param)
        {
            return await AssemblyService.UpdateFlowAssemblyConfigAttributeStstus(param);
        }

        #endregion

        #region 更新组件属性配置信息顺序

        /// <summary>
        /// 更新组件属性配置信息顺序
        /// </summary>
        /// <param name="param">更新参数集</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("UpdateFlowAssemblyConfigAttributeSort")]
        public async Task<IActionResult> UpdateFlowAssemblyConfigAttributeSort(UpdateModel param)
        {
            return await AssemblyService.UpdateFlowAssemblyConfigAttributeSort(param);
        }

        #endregion

        #region 获取可用组件数据

        /// <summary>
        /// 获取可用组件数据
        /// </summary>
        /// <param name="param">搜索条件</param>
        /// <returns>JSON结果集</returns>
        [HttpPost]
        [Route("FlowAssemblyData")]
        public async Task<IActionResult> FlowAssemblyData(SearchModel param)
        {
            return await AssemblyService.FlowAssemblyData(param);
        }

        #endregion

    }
}
